{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "U:\n",
      "[[-0.21483724  0.88723069  0.40824829]\n",
      " [-0.52058739  0.24964395 -0.81649658]\n",
      " [-0.82633754 -0.38794278  0.40824829]]\n",
      "S:\n",
      "[1.68481034e+01 1.06836951e+00 3.33475287e-16]\n",
      "V:\n",
      "[[-0.47967118 -0.57236779 -0.66506441]\n",
      " [-0.77669099 -0.07568647  0.62531805]\n",
      " [-0.40824829  0.81649658 -0.40824829]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "# 创建一个示例矩阵\n",
    "matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n",
    "\n",
    "# 使用numpy的svd函数进行矩阵分解\n",
    "U, S, V = np.linalg.svd(matrix)\n",
    "\n",
    "# 打印分解后的矩阵U，S和V\n",
    "print(\"U:\")\n",
    "print(U)\n",
    "print(\"S:\")\n",
    "print(S)\n",
    "print(\"V:\")\n",
    "print(V)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
